import { useEffect } from "react";

export function useSocket({user_id,server_id},cb){
    useEffect(()=>{
        const ws=new WebSocket(`ws://124.221.74.149:8003/koa/ws?user_id=${user_id}?&server_id=${server_id}?`)
        ws.onopen=()=>{
            console.log("open","服务器已经建立链接")
            cb && cb(ws)
        }
    },[])
}